package com.zh.zhbootcommon.common;


/**
 * 描述: 数据字典
 *
 * @author: yanglin
 * @Date: 2021-08-24-16:52
 * @Version: 1.0
 */
public enum CommonKey {

    UNKNOWN("unknown", "未知"),

    /**
     * 数据字典Code
     */
    ORDER_CREATE_TIME(10001,"订单创建有效时间(单位:秒)"),
    ORDER_PAY_TIME(10002,"订单支付有效时间(单位:秒)"),

    /**
     * 交易状态
     * SUCCESS—支付成功
     * REFUND—转入退款
     * NOTPAY—未支付
     * CLOSED—已关闭
     * REVOKED—已撤销（付款码支付）
     * USERPAYING--用户支付中（付款码支付）
     * PAYERROR--支付失败(其他原因，如银行返回失败)
     */
    PAY_SUCCESS("SUCCESS", "支付成功"),
    PAY_REFUND("REFUND", "转入退款"),
    PAY_NOTPAY("NOTPAY", "未支付"),
    PAY_CLOSED("CLOSED", "已关闭"),
    PAY_REVOKED("REVOKED", "已撤销"),
    PAY_USERPAYING("USERPAYING", "支付中"),
    PAY_PAYERROR("PAYERROR", "支付失败"),

    /**
     *
     订单状态(10-已创建(乘客发单) 20-已接单(司机接单) 30-待出发(司机抵达出发点)
     40-待抵达(司机已接到乘客/行驶中) 50-待支付(司机抵达目的) 60-已支付(乘客已支付)
     70-已完成  80-已取消)
     */
    ORDER_STATUS_10(10,"已创建(乘客发单)"),
    ORDER_STATUS_20(20,"已接单(司机接单)"),
    ORDER_STATUS_30(30,"待出发(司机抵达出发点)"),
    ORDER_STATUS_40(40,"待抵达(司机已接到乘客/行驶中)"),
    ORDER_STATUS_50(50,"待支付(司机抵达目的)"),
    ORDER_STATUS_60(60,"已支付(乘客已支付)"),
    ORDER_STATUS_70(70,"已完成"),
    ORDER_STATUS_80(80,"已取消"),
    /**
     * 支付状态(10-订单创建(待支付) 20-支付中 30-支付成功 40-支付失败 50-支付取消 60-申请退款 70-退款成功)
     */
    PAY_STATUS_10(10,"待支付"),
    PAY_STATUS_20(20,"支付中"),
    PAY_STATUS_30(30,"支付成功"),
    PAY_STATUS_40(40,"支付失败"),
    PAY_STATUS_50(50,"支付取消"),
    PAY_STATUS_60(60,"申请退款"),
    PAY_STATUS_70(70,"退款成功"),
    ;

    private Integer value;

    private String key;

    private String name;

    private CommonKey(Integer value, String name) {
        this.value = value;
        this.name = name;
    }
    private CommonKey(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static CommonKey getName(String key){
        CommonKey[] commonKeys = CommonKey.values();
        for (int i = 0; i < commonKeys.length; i++) {
            if (commonKeys[i].getKey().equals(key)) {
                return commonKeys[i];
            }
        }
        return CommonKey.UNKNOWN;
    }
}


